﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefIntgrSyncRemote" :model="stateIntgrSyncRemote.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Wo_FormItem" prop="Entity.Wo" :label="$t('message.autotrans._Model_IntgrSyncRemote_Wo')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.Wo" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Sn_FormItem" prop="Entity.Sn" :label="$t('message.autotrans._Model_IntgrSyncRemote_Sn')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_Sn')}), trigger: 'blur' }]" >
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.Sn" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_TransSnId_FormItem" prop="Entity.TransSnId" :label="$t('message.autotrans._Model_IntgrSyncRemote_TransSnId')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.TransSnId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ArchiveId_FormItem" prop="Entity.ArchiveId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ArchiveId')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.ArchiveId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineId_FormItem" prop="Entity.LineId" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineId')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.LineId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineCode')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ProductId_FormItem" prop="Entity.ProductId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductId')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.ProductId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ProductName_FormItem" prop="Entity.ProductName" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductName')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.ProductName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpId_FormItem" prop="Entity.OpId" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpId')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.OpId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpCode_FormItem" prop="Entity.OpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_OpCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.OpCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ErpOpCode_FormItem" prop="Entity.ErpOpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErpOpCode')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.ErpOpCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PassResult_FormItem" prop="Entity.PassResult" :label="$t('message.autotrans._Model_IntgrSyncRemote_PassResult')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_PassResult')}), trigger: 'blur' }]" >
            <el-select v-model="stateIntgrSyncRemote.vmModel.Entity.PassResult" clearable>
               <el-option key="OK" value="OK" :label="$t('message.autotrans._Enum_SnStatusEnum_OK')"></el-option>
               <el-option key="NG" value="NG" :label="$t('message.autotrans._Enum_SnStatusEnum_NG')"></el-option>
               <el-option key="MandatoryOK" value="MandatoryOK" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryOK')"></el-option>
               <el-option key="MandatoryNG" value="MandatoryNG" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryNG')"></el-option>
               <el-option key="Scrap" value="Scrap" :label="$t('message.autotrans._Enum_SnStatusEnum_Scrap')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Status_FormItem" prop="Entity.Status" :label="$t('message.autotrans._Model_IntgrSyncRemote_Status')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_Status')}), trigger: 'blur' }]" >
            <el-select v-model="stateIntgrSyncRemote.vmModel.Entity.Status" clearable>
               <el-option key="Ready" value="Ready" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Ready')"></el-option>
               <el-option key="Completed" value="Completed" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Completed')"></el-option>
               <el-option key="Failure" value="Failure" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Failure')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsFirst_FormItem" prop="Entity.IsFirst" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsFirst')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_IsFirst')}), trigger: 'blur' }]" >
            <el-switch v-model="stateIntgrSyncRemote.vmModel.Entity.IsFirst" clearable></el-switch>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsCompelted_FormItem" prop="Entity.IsCompelted" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsCompelted')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_IsCompelted')}), trigger: 'blur' }]" >
            <el-switch v-model="stateIntgrSyncRemote.vmModel.Entity.IsCompelted" clearable></el-switch>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SyncMethod_FormItem" prop="Entity.SyncMethod" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncMethod')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.SyncMethod" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SyncCount_FormItem" prop="Entity.SyncCount" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncCount')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_SyncCount')}), trigger: 'blur' }]" >
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.SyncCount" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ErrMessage_FormItem" prop="Entity.ErrMessage" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErrMessage')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.ErrMessage" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreatedTime_FormItem" prop="Entity.CreatedTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_CreatedTime')">
            <el-date-picker v-model="stateIntgrSyncRemote.vmModel.Entity.CreatedTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StartTime_FormItem" prop="Entity.StartTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_StartTime')">
            <el-date-picker v-model="stateIntgrSyncRemote.vmModel.Entity.StartTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EndTime_FormItem" prop="Entity.EndTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_EndTime')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_IntgrSyncRemote_EndTime')}), trigger: 'blur' }]" >
            <el-date-picker v-model="stateIntgrSyncRemote.vmModel.Entity.EndTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Remark_FormItem" prop="Entity.Remark" :label="$t('message.autotrans._Model_IntgrSyncRemote_Remark')">
            <el-input v-model="stateIntgrSyncRemote.vmModel.Entity.Remark" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onSubmitIntgrSyncRemote"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

        <WtmButton @click="onCloseIntgrSyncRemote"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageIntegrationManagementIntgrSyncRemoteEdit;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { intgrsyncremoteApi } from '/@/api/integrationmanagement/intgrsyncremote';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefIntgrSyncRemote = ref();
const stateIntgrSyncRemote = reactive({
    vmModel: {
	  Entity:{
        Wo: '',
        Sn: '',
        TransSnId: null,
        ArchiveId: null,
        LineId: null,
        LineCode: '',
        ProductId: null,
        ProductName: '',
        OpId: null,
        OpCode: '',
        ErpOpCode: '',
        PassResult: undefined,
        Status: undefined,
        IsFirst: undefined,
        IsCompelted: undefined,
        SyncMethod: '',
        SyncCount: null,
        ErrMessage: '',
        CreatedTime: undefined,
        StartTime: undefined,
        EndTime: undefined,
        Remark: '',
        ID:null,
      },

	},
    
});

// 取消
const onCloseIntgrSyncRemote = () => {
    closeDialog();
};

// 提交
const onSubmitIntgrSyncRemote = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefIntgrSyncRemote.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            intgrsyncremoteApi().edit(stateIntgrSyncRemote.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};

// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateIntgrSyncRemote.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateIntgrSyncRemote.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	intgrsyncremoteApi().get(stateIntgrSyncRemote.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateIntgrSyncRemote.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

